/*
 * @Author: llch
 * @Date: 2020-06-01 15:26:33
 * @LastEditTime: 2020-06-23 16:04:53
 * @LastEditors: Please set LastEditors
 * @Description: 
 * @FilePath: \idiom_demo\assets\script\game\Level.ts
 */ 

import { Idiom } from "./Idiom"
import { IdiomData } from "./IdiomData"

export class Level {
    private _jsonData = null;
    private _levelData = null;

    constructor(jsonData, levelData) {
        this._jsonData = jsonData;
        this._levelData = levelData;
    }

    public initLevelData() {
        let idioms = this._levelData.json["idioms"];
        let idiomArr = [];
        for (let i = 0; i < idioms.length; i++) {
            let _id = idioms[i].id
            let idiomdataObj = new IdiomData(this._jsonData.json[_id]);
            // 词条对象 存词条数据，占位
            let idiomObj: Idiom = new Idiom(idioms[i].grids, idiomdataObj);
            idiomArr.push(idiomObj);
        }
        return idiomArr;
    }
}
